# 后端服务测试脚本
Write-Host "测试BI平台后端服务..." -ForegroundColor Green

# 等待服务启动
Write-Host "等待后端服务启动..." -ForegroundColor Yellow
Start-Sleep -Seconds 30

# 测试健康检查接口
try {
    $response = Invoke-RestMethod -Uri "http://localhost:8080/api/actuator/health" -Method Get -TimeoutSec 10
    Write-Host "✅ 后端服务健康状态: $($response.status)" -ForegroundColor Green
    
    # 测试API接口
    $apiResponse = Invoke-RestMethod -Uri "http://localhost:8080/api/v1/wide-tables" -Method Get -TimeoutSec 10
    Write-Host "✅ API接口测试成功" -ForegroundColor Green
    
} catch {
    Write-Host "❌ 后端服务测试失败: $($_.Exception.Message)" -ForegroundColor Red
}

# 显示H2数据库控制台信息
Write-Host "`nH2数据库控制台: http://localhost:8080/api/h2-console" -ForegroundColor Cyan
Write-Host "JDBC URL: jdbc:h2:mem:testdb" -ForegroundColor Cyan
Write-Host "用户名: sa" -ForegroundColor Cyan
Write-Host "密码: (空)" -ForegroundColor Cyan

Write-Host "`n后端服务部署完成！" -ForegroundColor Green